import {
  strInfo
} from "@/api/my/userInfo";

export default {

  data() {
    return {
      CertifiedLoading: false,
    }
  },
  methods: {
    async handleCertified(call, title = '') {
      if (this.CertifiedLoading) {
        return;
      }
      this.CertifiedLoading = true;
      let {
        data
      } = await strInfo();
      if (data.message) {
        if (data.data.info.department) {
          this.CertifiedLoading = false;
          call()
        } else {
          uni.showModal({
            title: title,
            content: '成功认证后，可以发布文章、商品，以及和大家一起评论互动',
            cancelText: '不了',
            confirmText: '前往认证',
            success: (res) => {

              if (res.confirm) {
                uni.navigateTo({
                  url: "/pages/my/approve/approve"
                })

              }
            }

          })
          this.CertifiedLoading = false;
        }
      } else {
        uni.showToast({
          title: "认证信息获取失败",
          icon: "none"
        })
      }

    },

  }

}